home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 09 - 1993 / 09.06 Jun 93 / C Shell XCMD / Flash.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-21  |  932 b   |  40 lines  |  [TEXT/KAHL]

  1. #include <string.h>
  2. #include <QuickDraw.h>
  3. #include "Flash.h"
  4.  
  5. pascal void FlashMain(XCmdPtr paramPtr)
  6. {
  7.     short    again;
  8.     long    flashCount;
  9.     Handle    returnHdl;
  10.     GrafPtr    port;
  11.     Str255    str, tempStr;
  12.  
  13.     // First param is flash count.  Convert it to a pascal string
  14.     returnHdl = NewHandle(256L);
  15.     strcpy((char*)str, (char*)*(unsigned char **)paramPtr->params[0]);
  16.     CtoPstr((char*)str);
  17.     
  18.     // Convert the string to a number
  19.     StringToNum(str, &flashCount);
  20.     PtoCstr((char*)str);
  21.     
  22.     // Invert the screen and sound the beep.
  23.     GetPort(&port);
  24.     for (again = 0; again < flashCount; again++) 
  25.     {
  26.         InvertRect(&port->portRect);
  27.         InvertRect(&port->portRect);
  28.         SysBeep(5);
  29.     }
  30.     
  31.     // Build the return string.
  32.     strcpy((char*)tempStr, "The number of flashes was ");
  33.     strcat((char*)tempStr, (char*)str);
  34.     strcat((char*)tempStr, " ");
  35.     strcat((char*)tempStr, (char*)"\r");
  36.     strcpy((char*)*returnHdl, (char*)tempStr);
  37.     paramPtr->returnValue = returnHdl;
  38. }
  39.  
  40.